#include "shm.h"
#include "comm.hpp"

int main()
{
    int shmid = getShm(4096);
    char *ptr = (char *)shmat(shmid, nullptr, 0);

    int fd = open(filename, O_WRONLY | O_TRUNC);

    std::string tmp;
    while (1)
    {
        printf("Please enter: ") ;
        fflush(stdout);
        getline(std::cin, tmp);
        int flag = 0;
        write(fd, &flag, sizeof(flag));
        strcpy(ptr, tmp.c_str());
    }

    close(fd);
    if (shmdt(ptr) < 0)
    {
        perror("shmdt fail");
        exit(4);
    }
    return 0;
}